/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.pucp.sigepa.recocidosimulado.Modelo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author carloslengua
 */
@Entity
@Table(name = "tipo_correo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TipoCorreo.findAll", query = "SELECT t FROM TipoCorreo t"),
    @NamedQuery(name = "TipoCorreo.findByIdtipocorreo", query = "SELECT t FROM TipoCorreo t WHERE t.idtipocorreo = :idtipocorreo"),
    @NamedQuery(name = "TipoCorreo.findByDescripcion", query = "SELECT t FROM TipoCorreo t WHERE t.descripcion = :descripcion"),
    @NamedQuery(name = "TipoCorreo.findByExtension", query = "SELECT t FROM TipoCorreo t WHERE t.extension = :extension")})
public class TipoCorreo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idtipocorreo")
    private Integer idtipocorreo;
    @Basic(optional = false)
    @Column(name = "descripcion")
    private String descripcion;
    @Basic(optional = false)
    @Column(name = "extension")
    private String extension;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipoCorreo", fetch = FetchType.LAZY)
    private List<Usuario> usuarioList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipoCorreo", fetch = FetchType.LAZY)
    private List<Cliente> clienteList;

    public TipoCorreo() {
    }

    public TipoCorreo(Integer idtipocorreo) {
        this.idtipocorreo = idtipocorreo;
    }

    public TipoCorreo(Integer idtipocorreo, String descripcion, String extension) {
        this.idtipocorreo = idtipocorreo;
        this.descripcion = descripcion;
        this.extension = extension;
    }

    public Integer getIdtipocorreo() {
        return idtipocorreo;
    }

    public void setIdtipocorreo(Integer idtipocorreo) {
        this.idtipocorreo = idtipocorreo;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public String getExtension() {
        return extension;
    }

    public void setExtension(String extension) {
        this.extension = extension;
    }

    @XmlTransient
    public List<Usuario> getUsuarioList() {
        return usuarioList;
    }

    public void setUsuarioList(List<Usuario> usuarioList) {
        this.usuarioList = usuarioList;
    }

    @XmlTransient
    public List<Cliente> getClienteList() {
        return clienteList;
    }

    public void setClienteList(List<Cliente> clienteList) {
        this.clienteList = clienteList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idtipocorreo != null ? idtipocorreo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoCorreo)) {
            return false;
        }
        TipoCorreo other = (TipoCorreo) object;
        if ((this.idtipocorreo == null && other.idtipocorreo != null) || (this.idtipocorreo != null && !this.idtipocorreo.equals(other.idtipocorreo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.pucp.sigepa.recocidosimulado.Modelo.TipoCorreo[ idtipocorreo=" + idtipocorreo + " ]";
    }
    
}
